Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] [Bugfix] Fix TieredSpilloverCache stats not adding correctly when sha… #16790

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

peteralfonsi
Copy link
Contributor

Backport c82cd2e from #16560.

Opened a manual backport as the earlier one was getting stuck and I couldn't fix merge conficts without write permissions. I've closed the other one.

…rds are closed (opensearch-project#16560)

* added draft tests for tsc stats holder

Signed-off-by: Peter Alfonsi <[email protected]>

* first draft tsc stats bugfix

Signed-off-by: Peter Alfonsi <[email protected]>

* Complete tests

Signed-off-by: Peter Alfonsi <[email protected]>

* Cleanup

Signed-off-by: Peter Alfonsi <[email protected]>

* Integrate fix with TSC

Signed-off-by: Peter Alfonsi <[email protected]>

* Add IT

Signed-off-by: Peter Alfonsi <[email protected]>

* Refactor cache package names in TSC module to match with server

Signed-off-by: Peter Alfonsi <[email protected]>

* changelog

Signed-off-by: Peter Alfonsi <[email protected]>

* Revert "Refactor cache package names in TSC module to match with server"

This reverts commit 3b15a7a.

Signed-off-by: Peter Alfonsi <[email protected]>

* Addressed Sagar's comments

Signed-off-by: Peter Alfonsi <[email protected]>

* More package fixes

Signed-off-by: Peter Alfonsi <[email protected]>

* Addressed andross's comments

Signed-off-by: Peter Alfonsi <[email protected]>

---------

Signed-off-by: Peter Alfonsi <[email protected]>
Signed-off-by: Peter Alfonsi <[email protected]>
Co-authored-by: Peter Alfonsi <[email protected]>
(cherry picked from commit c82cd2e)
Copy link
Contributor

github-actions bot commented Dec 5, 2024

✅ Gradle check result for aeb226d: SUCCESS

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 71.82%. Comparing base (8f13e69) to head (48e8c1a).
Report is 7 commits behind head on 2.x.

Files with missing lines Patch % Lines
...search/cache/common/tier/TieredSpilloverCache.java 75.00% 0 Missing and 1 partial ⚠️
...e/common/tier/TieredSpilloverCacheStatsHolder.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x   #16790      +/-   ##
============================================
- Coverage     71.88%   71.82%   -0.07%     
+ Complexity    65506    65435      -71     
============================================
  Files          5314     5314              
  Lines        305364   305369       +5     
  Branches      44501    44501              
============================================
- Hits         219522   219320     -202     
- Misses        67535    67744     +209     
+ Partials      18307    18305       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@jainankitk jainankitk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @peteralfonsi for raising this backport PR manually. Overall looks good, except for some of the seemingly unnecessary access modifiers. Can you fix that please, for main as well before merging this PR?

return statsRoot;
}

/**
* Nodes that make up the tree in the stats holder.
*/
protected static class Node {
public static class Node {
private final String dimensionValue;
// Map from dimensionValue to the DimensionNode for that dimension value.
final Map<String, Node> children;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should this be private now since the getter is public? I am assuming we don't directly initialize children outside of the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't be private since ImmutableCacheStatsHolder uses it during construction. But I can make it protected again. After reworking the TSC stats holder tests, it doesn't need to be public.

Comment on lines 212 to 215
Node getStatsRoot() {
public Node getStatsRoot() {
return statsRoot;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Why does this need to be public? I don't any other usage throughout this PR

Signed-off-by: Peter Alfonsi <[email protected]>
@peteralfonsi
Copy link
Contributor Author

peteralfonsi commented Dec 10, 2024

@jainankitk The access changes were made because the TSC stats holder and original stats holder are in different packages, and testing was a problem without them. But, I was able to rework the tests to use the ImmutableCacheStatsHolder to read any necessary values, so I've reverted the access modifiers to the way they were before this PR.

I'll raise the corresponding PR for main once we're happy with this version of the changes.

Copy link
Contributor

✅ Gradle check result for 48e8c1a: SUCCESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants